home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_11_07 / 1107109a < prev    next >
Text File  |  1993-04-28  |  506b  |  25 lines

  1. // copy4.cpp: Copy one file to another
  2. #include <iostream.h>
  3. #include <fstream.h>  // Required for file streams
  4. #include <stdlib.h>
  5.  
  6. main(int argc, char *argv[])
  7. {
  8.     if (argc == 3)
  9.     {
  10.         ifstream inf(argv[1]);
  11.         ofstream outf(argv[2]);
  12.         if (inf && outf)
  13.         {
  14.             char c;
  15.  
  16.             while (inf.get(c))
  17.                 outf.put(c);
  18.  
  19.             return EXIT_SUCCESS;
  20.         }  // Streams destroyed by this point
  21.     }
  22.     return EXIT_FAILURE;
  23. }
  24.  
  25.